﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Csharp2048
{
    enum Direction
    {
        Up,
        Down,
        Left,
        Right
    }
    internal class KeyboardInteraction
    {
        static public Direction WaitForKeyPress()
        {


            while (true)
            {
                
                var key = Console.ReadKey(intercept: true);
                if (key.Key == ConsoleKey.W || key.Key == ConsoleKey.UpArrow)
                {   
                    return Direction.Up;
                }
                else if(key.Key == ConsoleKey.S||key.Key == ConsoleKey.DownArrow)
                {
                    return Direction.Down;
                }
                else if(key.Key == ConsoleKey.A || key.Key == ConsoleKey.LeftArrow)
                {
                    return Direction.Left;
                }
                else if(key.Key == ConsoleKey.D || key.Key == ConsoleKey.RightArrow)
                {
                    return Direction.Right;
                }
            }
        }
    }
}
